// const test = 'http://localhost:8080/api/v1/nav'

const install = (Vue, vm) => {
	const creatPostApi = (path) => {
		return (params = {}) => vm.$u.http.post(path, params)
	}
	const creatGetApi = (path) => {
		return (params = {}) => vm.$u.http.get(path, params)
	}

	const wxlogin = creatGetApi('/user/login'); //用户登录 {code:1}
	// const wxlogin = creatPostApi('/v1/mem/login');//用户登录 {code:1}
	const getUserInfo = creatPostApi('/user/info'); //用户信息 {sessionKey, encryptedData, iv}

	const getUserPhone = creatGetApi('/user/phone'); //获取手机号 {sessionKey, encryptedData, iv}

	const getHomeBanner = creatGetApi('/carousel/'); //获取首页轮播图

	const getPlayClass = creatGetApi('/big-class/'); //查询基本分类 {}

	const getScriptList = creatPostApi('/play/list'); //剧本列表 {page:1,number:10,select:[1,2,3]}

	const getScriptInfo = creatGetApi('/play/xiang'); //剧本详情 {playId:1}

	const getScriptLike = creatGetApi('/play/like'); //猜你喜欢 {playId:1}

	const getScriptByName = creatGetApi('/play/playname'); //剧本名搜索 {name:XXX}

	const addPlayed = creatGetApi('/played/'); //添加玩过的剧本 {userId:2,playId:42,score:8}

	const addWantPlay = creatGetApi('/want/'); //添加想玩的剧本 {userId:2,playId:41}

	const delWantPlay = creatGetApi('/want/delete'); //删除想玩的剧本 {userId:2,playId:41}

	const getPlayedList = creatGetApi('/played/list'); //查询玩过的剧本列表 {userId:2,page:1,number:3}

	const getWantList = creatGetApi('/want/list'); //查询想玩的剧本列表 {userId:2,page:1,number:3}

	const getBusinessList = creatPostApi('/store/'); //获取商家列表 {city:成都,page:1,number:1,storeName:""}

	const getBusinessInfo = creatGetApi('/room/room'); //获取商家详情 {id:1}

	const getBusinessCarousel = creatGetApi('/store/getStoreCarousel'); //获取商家详情 {storeId:1}

	const AddOrder = creatPostApi(
		'/order/car'); //添加预约 {playId:7,storeId:2,userId:1000006,date:2021-7-1,time:12:30,people:6,roomId:2}

	const getPinList = creatPostApi('/order/select'); //拼车列表 {name:紫,page:1:number:3,date:2020-07-05}

	const myOrder = creatGetApi('/order/order'); //查询我的预约列表 {userId:1000006,page:1,numbr:3,select:1}

	const FleetDetails = creatGetApi('/order/carxiang'); //车队详情 {id:7,userId:1000006}

	const getBussinesListByPlayAndCity = creatPostApi(
		'/store-play/store'); //通过剧本和城市查询商家列表 {city:成都,play_id:7,page:1,number:3}

	const getBussinesInfoById = creatPostApi('/store-play/room'); //通过商家id获取商家信息 {store_id:1}  //预约

	const CrudCar = creatPostApi('/order/exit'); //车队的解散0，加入1，退出2 {select:0,id:13,userId:1000006}

	const SstoreApply = creatPostApi(
		'/store/apply'
	); //商家入驻申请 {user_id:0,store_name:13,licenseImgUrl:1000006,telephone:,wechat_number:,province:,city:,region:,address:,picture:''}

	const Upload = creatPostApi('/store/upload'); //上传图片 0 商家logo 1 营业执照 2 房间图 3 主持人 4 主持人轮播 5 商家背景图 6上传商家轮播

	const getStoreInfoById = creatPostApi('/store/storexiang'); //{store_id:1,}//门店详情  

	const getStorePlayList = creatPostApi('/store/hot'); //{store_id:1,select:1,}//门店热门剧本

	const getStoreHostList = creatPostApi('/present/'); //{id:1,}//门店主持人列表，传门店id

	const getStoreHostCarousel = creatGetApi('/present-carousel/'); //{id:1,}//主持人轮播图，传主持人id

	const SystemInfo = creatGetApi('/background/get'); //{}//小程序背景

	const RankList = creatGetApi('/play/ranking'); //{select=3,page=1,number=3}//排行榜单，1剧本热度，2剧本积分，3主持人热度

	const getHostInfo = creatGetApi('/present/getPresentXiang'); //{presentId:3,page:1,number:10}//主持人详情

	const setHostScore = creatGetApi('/present/score'); //{presentId:3,userId:1,score:10}//给主持人评分

	const getQualityStore = creatGetApi('/store/quality'); //{city:成都,page:1,number:10}//优质商家

	const getNewStore = creatGetApi('/store/new'); //{city:成都,page:1,number:10}//新店推荐

	const getUserIsbussiness = creatGetApi('/store/userStore'); //{userId:1}//查询用户是否商家

	const getBussinessPinList = creatGetApi(
		'/store/getOrder'); //{userId:1}//查询店铺车队 0 核销了的车队 1 组满了的车队 2 正在组队的车队 3 解散了的车队
		
		const getStoreCoupon = creatGetApi(
			'/store/getStoreCoupon'); //{storeId=10&page=1&number=5}//查询商家优惠券列表

	const getHostScriptList = creatGetApi('/background/recommend'); //{}//查询热门剧本 首页

	const getCouponList = creatPostApi(
		'/my-coupon/coupon'); //{select:1,userId:4}//查询优惠券 select=0优惠券列表，1未使用优惠券列表，2已使用，3已过期

	const receiveCoupon = creatPostApi('/my-coupon/receive'); //{couponId:1,userId:4}//领取优惠券

	const getCustomerInfo = creatPostApi('/contact/get'); //{}//获取客服微信信息

	const getMoneySet = creatPostApi('/money-set/getMoneySet'); //{}//获取充值金额列表

	const RechargeBalance = creatPostApi('/recharge/record'); //{userId:1,moneySetId:1,}//充值金额

	const userBalanceInfo = creatPostApi('/user/userInformation'); //{userId:1}//获取用户余额，会员，积分信息

	const getCustomerPhone = creatPostApi('/contact/phone'); //获取客服联系电话

	const getMenberList = creatPostApi('/recharge/member'); //会员购买详情 

	const getMenber = creatPostApi('/recharge/change'); //{userId:4,id:1} 购买会员 

	const payBefore = creatPostApi('/order/pay'); //{userId=4,orderId} 支付前

	//弃用 const InPayment = creatPostApi('/consum/record');//{userId:1,orderId:1,couponId:1,payType:1} 支付中

	const recharge = creatPostApi('/recharge/recharge'); //{userId:1,select:1} 消费记录

	const getWriteCode = creatPostApi('/order/verification'); //{userId=4,orderId} 获取核销码

	const InitiateRefund = creatPostApi('/order/tuikuan'); //{userId=4,orderId} 发起退款

	const diamondsWay = creatPostApi('/diamonds/way'); //{} 获取剧本形式类型 和 砖石卡的次数

	const getStoreCar = creatPostApi('/diamonds/getStoreCar'); //{} 获取该城市的商家并且是可以买卡的
	
	const diamondMoney = creatPostApi('/diamonds/money'); //{} 计算购买钻石卡的金额
	
	const buydiamondCar = creatPostApi('/diamonds/buyCar'); //{} 用户购买钻石卡
	
	const getUserCar = creatPostApi('/usercar/getUserCar'); //{userId} 我的钻石卡列表
	
	const getStores = creatPostApi('/usercar/getStores'); //{userId} 获取砖石卡对应的商家列表
	
	const diamondPlayList = creatPostApi('/usercar/playList'); //{userId} 获取该砖石卡在商家可预约的剧本列表
	
	const getActiveDiamonds = creatPostApi('/diamonds/getActiveDiamonds'); //{} 查询活动砖石卡  √
	
	const activeStoreList = creatPostApi('/diamonds/activeStoreList'); //{} 查询活动砖石卡可使用的商家列表  √
	
	const buyActive = creatPostApi('/diamonds/buyActive'); //{} 用户购买活动卡  √
	
	const getDiamondsService = creatPostApi('/background/getService'); //{} 钻石卡服务条款  √
	
	const addTemporary = creatPostApi('/order/addTemporary'); //{} 用户加入临时车位 select 0 加入 1 退出  √


	vm.$u.api = { //暴露出去方法
		getScriptList,
		getScriptInfo,
		getScriptLike,
		wxlogin,
		getUserInfo,
		getUserPhone,
		getHomeBanner,
		getPlayClass,
		getScriptByName,
		addPlayed,
		addWantPlay,
		delWantPlay,
		getPlayedList,
		getWantList,

		getBusinessList,
		getBusinessInfo,
		getBusinessCarousel,
		getStoreInfoById,
		getStorePlayList,
		getStoreHostList,
		getStoreHostCarousel,
		getHostInfo,
		setHostScore,
		getQualityStore,
		getNewStore,
		getUserIsbussiness,
		getBussinessPinList,
		getStoreCoupon,

		getHostScriptList,

		SystemInfo,
		RankList,

		AddOrder,
		getPinList,
		myOrder,
		FleetDetails,
		getBussinesListByPlayAndCity,
		getBussinesInfoById,
		CrudCar,
		getCouponList,
		receiveCoupon,
		getCustomerInfo,
		getCustomerPhone,
		getMoneySet,
		RechargeBalance,
		userBalanceInfo,

		getMenberList,
		getMenber,
		payBefore,
		// InPayment,
		recharge,
		getWriteCode,
		InitiateRefund,

		SstoreApply,
		Upload,


		diamondsWay,
		getStoreCar,
		diamondMoney,
		buydiamondCar,
		getUserCar,
		getStores,
		diamondPlayList,
		getActiveDiamonds,
		activeStoreList,
		buyActive,
		getDiamondsService,
		addTemporary,
	}
}

export default {
	install
}
